package com.extension.company.view.my.onlineorder;

import android.app.Activity;
import android.content.Intent;
import android.view.View;

import com.extension.company.admin.R;
import com.extension.company.common.mvp.BaseTitleActivity;
import com.extension.company.contract.OrderWaitPaymentListContract;
import com.extension.company.model.entity.OrderListData;
import com.extension.company.presenter.my.OrderWaitPaymentListPresenter;
import com.extension.company.view.adapter.OnRecyclerViewClickListener;
import com.extension.company.view.adapter.OrderWaitPaymentListAdapter;
import com.extension.company.common.widget.PullRefreshRecyclerView;

import java.util.List;

import butterknife.BindView;

public class OrderWaitPaymentList extends BaseTitleActivity<OrderWaitPaymentListContract.View, OrderWaitPaymentListPresenter>
		implements OrderWaitPaymentListContract.View {

	@BindView(R.id.mRecyclerView)
	PullRefreshRecyclerView mRecyclerView;

	private List<OrderListData> list;
	private OrderWaitPaymentListAdapter adapter;

	//0 待付款，1代发货，2待收货，3待评价
	private int flags = 0;

	private final String[] titles = {"待付款", "待发货", "待收货", "待评价"};

	public static void startActivity(Activity activity, int flags) {
		Intent intent = new Intent(activity, OrderWaitPaymentList.class);
		intent.putExtra("flags", flags);
		activity.startActivity(intent);
	}

	@Override
	protected void initData() {
		flags = getIntent().getIntExtra("flags", 0);
		setTitle(titles[flags]);
		mRecyclerView.setLinearLayout();
		adapter = new OrderWaitPaymentListAdapter(this, list);
		mRecyclerView.setAdapter(adapter);
		adapter.setOnClickListener(new OnRecyclerViewClickListener() {
			@Override
			public void onItemClick(View view, int position) {
				Intent intent = new Intent(OrderWaitPaymentList.this, MyOnlineOrderDetail.class);
				startActivity(intent);
			}

			@Override
			public void onItemLongClick(View view, int position) {

			}
		});
	}

	@Override
	protected void initListener() {

	}

	@Override
	public int getMainLayout() {
		return R.layout.base_recyclerview;
	}

	@Override
	public OrderWaitPaymentListContract.View createView() {
		return this;
	}

	@Override
	public OrderWaitPaymentListPresenter createPresenter() {
		return new OrderWaitPaymentListPresenter();
	}

	@Override
	public void showLoading() {

	}

	@Override
	public void hideLoading() {

	}

	@Override
	public void onError(Throwable throwable) {

	}
}
